/*
 * Copyright 2018- The Pixie Authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 * SPDX-License-Identifier: Apache-2.0
 */

syntax = "proto3";

package px.services;

option go_package = "projectmanagerpb";

import "github.com/gogo/protobuf/gogoproto/gogo.proto";
import "src/api/proto/uuidpb/uuid.proto";

service ProjectManagerService {
  // Checks to see a particular subdomain is available for registration.
  rpc IsProjectAvailable(IsProjectAvailableRequest) returns (IsProjectAvailableResponse);
  // Registers a project for an organization.
  rpc RegisterProject(RegisterProjectRequest) returns (RegisterProjectResponse);
  rpc GetProjectForOrg(px.uuidpb.UUID) returns (ProjectInfo);
  rpc GetProjectByName(GetProjectByNameRequest) returns (ProjectInfo);
}

message ProjectInfo {
  string project_name = 1;
  px.uuidpb.UUID org_id = 2 [ (gogoproto.customname) = "OrgID" ];
}

message GetProjectByNameRequest {
  string project_name = 1;
  px.uuidpb.UUID org_id = 2 [ (gogoproto.customname) = "OrgID" ];
}

message IsProjectAvailableRequest {
  // The project name to check. For example, if we want to check that walmart.pixie.ai is available
  // we will check the project name walmart.
  string project_name = 1;
  px.uuidpb.UUID org_id = 2 [ (gogoproto.customname) = "OrgID" ];
}

message IsProjectAvailableResponse {
  bool available = 1;
}

message RegisterProjectRequest {
  // The project name to register.
  string project_name = 1;
  // The UUID of the org name.
  px.uuidpb.UUID org_id = 2 [ (gogoproto.customname) = "OrgID" ];
}

message RegisterProjectResponse {
  // TODO(zasgar/michellenguyen, PC-829): This should actually be our Status proto type.
  bool project_registered = 1;
}
